Code base

All contributions will be done on Github, including PR, review process etc.

Bugs reporting

Please file the issue in the github projects above. Please ensure your issue has not been reported earlier.

Versioning

The functional TDK follows semantic versioning, patch versions for bug fixes, minor versions for new features, major versions for non-backwards compatible updates.

Customize command

We provide a base-command.js for inheritance to implement your own command for browser test. To implement a command for browser usage, you need to

  1. Inherit your command from the base-command.js.
  2. Implement method do() and command()
Method Purpose Arguments
do(magellanSelector) Called by base test if element exists and is visible, you can do you own things in this method. magellanSelector is the selector you should use which is generated by nightwatch-extra
command(…, callback) The command signature which user will use in their test Parameter amount can be arbitary with an optional callback which will be called when the command successfully finishes.
  1. Add the path of your new command to nightwatch.json
  "custom_commands_path": [
    "./node_modules/testarmada-nightwatch-extra/lib/commands",
    "./node_modules/testarmada-nightwatch-extra/lib/commands/mobile",
    "./lib/custom_commands"
  ],

Customize assertion

We provide a base-assertion.js for inheritance to implement your own assertion for browser test. To implement an assertion for browser test, you need to

  1. Inherit your assertion from the base-assertion.js.
  2. Implement method do(), assert() and command().
Method Purpose Arguments
do(magellanSelector) Called by base test if element exists and is visible, you can do you own things in this method. magellanSelector is the selector you should use which is generated by nightwatch-extra
assert(actual, expected) Called by base assertion if element exists and is visible, you can do you own assertion in this method. actual is the actual value returned by injectedJsCommand() method, expected is the expected value passed in command() method
command(selector, expected, …, callback) The command signature which user will use in their test Parameter amount can be arbitary with a selector, an expected value and an optional callback which will be called when the assertion successfully finishes.
  1. Add the path to your new assertion to nightwatch.json
  "custom_assertions_path": [
    "./node_modules/testarmada-nightwatch-extra/lib/assertions",
    "./node_modules/testarmada-nightwatch-extra/lib/assertions/mobile",
    "./lib/custom_assertions"
  ],

Contribute to reporter

Create a reporter

A reporter must implement following methods.

Method Purpose
initialize() initialize current reporter instance
listenTo(testRun, test, source) listen to magellan’s test run
_handleMessage(testRun, test, msg) will be called when magellan emits certain events
flush() will be called when magellan finishes

Please note: _handleMessage() will be called per test. Please handle the error properly if it happens in one of the _handleMessage() so all your following _handleMessage() and flush() don’t error out.

Enable your reporter

To enable multiple reporters, simply add them in magellan.json

"reporters": [
    "testarmada-magellan-xunit-reporter",
    "testarmada-magellan-dev-reporter"
  ],